<template>
    <div>
        <div style="background: #fff;border-radius: 6px 6px 0 0;padding: 10px;margin-bottom: 2px;">
            <a-button @click="goBack">返回</a-button>
        </div>

        <div style="background: #fff;border-radius:0 0 6px 6px;padding:  20px 20px 0 20px;">
            <div style="color: #171a1d;font-family: PingFangSC-Medium;font-size: 17px;letter-spacing: 0;">
                快速设置教职工
                <a-button type="primary" style="position: absolute;right: 10px;">Excel导入批量配置</a-button>
            </div>
            <div
                style="margin-bottom: 10px;color: rgba(23,26,29,.4);font-family: PingFangSC-Regular;font-size: 14px;letter-spacing: 0;">
                集中配置各级负责人、班主任和任课教职工，教职工可对配置范围内的家长进行「家校沟通」
            </div>
            <a-table :columns="columns" :data-source="data" @onChange="onChange" @onSelect="onSelect" 
                @onSelectAll="onSelectAll" defaultExpandAllRows="true" />
        </div>
    </div>
</template>
  
<script>
export default {
    name: "SetupTeacher",
    data() {
        return {
            data: [
                {
                    key: 1,
                    name: 'John Brown sr.',
                    age: 60,
                    address: 'New York No. 1 Lake Park',
                    children: [
                        {
                            key: 11,
                            name: 'John Brown',
                            age: 42,
                            address: 'New York No. 2 Lake Park',
                        },
                        {
                            key: 12,
                            name: 'John Brown jr.',
                            age: 30,
                            address: 'New York No. 3 Lake Park',
                            children: [
                                {
                                    key: 121,
                                    name: 'Jimmy Brown',
                                    age: 16,
                                    address: 'New York No. 3 Lake Park',
                                },
                            ],
                        },
                        {
                            key: 13,
                            name: 'Jim Green sr.',
                            age: 72,
                            address: 'London No. 1 Lake Park',
                            children: [
                                {
                                    key: 131,
                                    name: 'Jim Green',
                                    age: 42,
                                    address: 'London No. 2 Lake Park',
                                    children: [
                                        {
                                            key: 1311,
                                            name: 'Jim Green jr.',
                                            age: 25,
                                            address: 'London No. 3 Lake Park',
                                        },
                                        {
                                            key: 1312,
                                            name: 'Jimmy Green sr.',
                                            age: 18,
                                            address: 'London No. 4 Lake Park',
                                        },
                                    ],
                                },
                            ],
                        },
                    ],
                },
                {
                    key: 2,
                    name: 'Joe Black',
                    age: 32,
                    address: 'Sidney No. 1 Lake Park',
                },
            ],
            columns: [
                {
                    title: '校区/学段/年级/班级',
                    dataIndex: 'name',
                    key: 'name',
                },
                {
                    title: '负责人',
                    dataIndex: 'age',
                    key: 'age',
                    width: '12%',
                },
                {
                    title: '班主任',
                    dataIndex: 'age',
                    key: 'age',
                    width: '12%',
                },
                {
                    title: '任课教职工',
                    dataIndex: 'address',
                    width: '20%',
                    key: 'address',
                },
            ],
            expandedRowKeys: [],
        };
    },
    methods: {
        goBack() {
            this.$router.back();
        },
        onChange: (selectedRowKeys, selectedRows) => {
            console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
        },
        onSelect: (record, selected, selectedRows) => {
            console.log(record, selected, selectedRows);
        },
        onSelectAll: (selected, selectedRows, changeRows) => {
            console.log(selected, selectedRows, changeRows);
        },
    },
};
</script>

<style scoped></style>
